package com.blockmeta.bbs.immodule.bean.databean;

import com.blockmeta.bbs.baselibrary.base.app.BaseApp;
import com.blockmeta.bbs.baselibrary.utils.FormatUtil;
import com.blockmeta.bbs.baselibrary.utils.SharedPreferenceUtil;
import com.blockmeta.bbs.businesslibrary.constant.Constant;
import com.blockmeta.bbs.businesslibrary.pojo.BaseContentBean;
import com.blockmeta.bbs.immodule.bean.beaninterface.IMarketAndF10Bean;
import com.google.gson.annotations.SerializedName;

public class F10ContentBean extends BaseContentBean implements IMarketAndF10Bean {
    private String coin_key = "";
    private String symbol = "";
    private String coin_name = "";
    private String cn_name = "";
    private String logo = "";
    private String description = "";

    @SerializedName("change")
    public String increase;
    @SerializedName("total")
    public String marketValue;
    @SerializedName("price")
    public String priceDollar;
    /** describption */
    public String desc;
    /** logo */
    public String coin_img;
    /** cn_name */
    public String chinese_name;
    /**coin_name*/
    public String name;

    private boolean isChecked;

    public String getCoin_key() {
        return coin_key;
    }

    public void setCoin_key(String coin_key) {
        this.coin_key = coin_key;
    }

    public String getSymbol() {
        return symbol;
    }

    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    public String getCoin_name() {
        return coin_name;
    }

    public void setCoin_name(String coin_name) {
        this.coin_name = coin_name;
    }

    public String getCn_name() {
        return cn_name;
    }

    public void setCn_name(String cn_name) {
        this.cn_name = cn_name;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String getSimpleName() {
        return symbol;
    }

    @Override
    public String getPriceRMB() {
        return "¥ " + FormatUtil.usd2cny(priceDollar
                , SharedPreferenceUtil.getFloat(BaseApp.getApp(), Constant.CNY_USD, 6.4f));
    }

    @Override
    public String getMarketValue() {
        long maketValue = Long.parseLong(marketValue.replaceAll(",","").trim());
        return "市值 $ "+FormatUtil.longToVolumeHumanReadableFormat(maketValue,2);
    }

    @Override
    public String getPriceDollar() {
        return "$ "+priceDollar;
    }

    @Override
    public double getIncrease() {
        return Double.parseDouble(increase);
    }

    @Override
    public String getFullName() {
        return name;
    }

    @Override
    public void setSelected(boolean selected) {
        coin_name = name;
        description = desc;
        logo = coin_img;
        cn_name = chinese_name;
        isChecked = selected;
    }

    @Override
    public boolean isSelected() {
        return isChecked;
    }
}
